//
//  TZjingPInDetailViewCell.m
//  XMLYFM
//
//  Created by dllo on 15/12/23.
//  Copyright © 2015年 zzl. All rights reserved.
//

#import "TZjingPInDetailViewCell.h"
#import <Masonry.h>
#import <UIImageView+WebCache.h>
@implementation TZjingPInDetailViewCell
-(instancetype)initWithFrame:(CGRect)frame

{

    if (self = [super initWithFrame:frame]) {
        [self creatSubViews];
    }

    return self;
    
}

-(void)creatSubViews
{
    self.newsPic = [[UIImageView alloc]init];
    self.newsPic.backgroundColor = [UIColor blueColor];
    [self.contentView addSubview:self.newsPic];
    
    [self.newsPic mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView.mas_left).offset(0);
        make.top.equalTo(self.contentView.mas_top).offset(0);
        make.height.equalTo(self.contentView.mas_height);
        make.width.mas_equalTo(TZWIDTH * 0.15);
        
        
    }];

    self.newsTitle = [[UILabel alloc]init];
    [self.contentView addSubview:self.newsTitle];
    
    [self.newsTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.newsPic.mas_right).offset(10);
        make.top.equalTo(self.newsPic.mas_top).offset(3);
        make.size.mas_equalTo(CGSizeMake(220, 20));
        
        
    }];
    
    self.newsDigest = [[UILabel alloc]init];
    [self.contentView addSubview:self.newsDigest];
    [self.newsDigest mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.newsTitle.mas_left);
        make.top.equalTo(self.newsTitle.mas_bottom).offset(10);
        make.size.mas_equalTo(CGSizeMake(220, 20));
        
        
        
    }];
    
}
-(void)setJingPinModel:(TZJingPinModel *)jingPinModel
{

    NSString *imgStr = jingPinModel.coverPath;
    NSURL *ImgUrl = [NSURL  URLWithString:imgStr];
    [self.newsPic sd_setImageWithURL:ImgUrl placeholderImage:nil];
 
    self.newsTitle.text = jingPinModel.title;
    self.newsDigest.text = jingPinModel.subtitle;
    
}
@end
